<!DOCTYPE html>
<html>
 <head>
    <title>Canvas Stroke Rect Example</title>
 </head>
 <body>
    <canvas id="drawing" width="200" height="200">Your browser doesn't support the canvas tag.</canvas>
    <script type="text/javascript">
        window.onload = function(){
            var drawing = document.getElementById("drawing");
            
            //make sure <canvas> is completely supported
            if (drawing.getContext){
            
                var context = drawing.getContext("2d");

                //setup shadow
                context.shadowOffsetX = 5;
                context.shadowOffsetY = 5;
                context.shadowBlur    = 4;
                context.shadowColor   = "rgba(0, 0, 0, 0.5)";
                            
                //draw a red rectangle
                context.strokeStyle = "#ff0000";
                context.strokeRect(10, 10, 50, 50);
            
                //draw a blue rectangle that's semi-transparent
                context.strokeStyle = "rgba(0,0,255,0.5)";
                context.strokeRect(30, 30, 50, 50);
            }                
        };

    </script>
    <p>This example based on <a href="http://developer.mozilla.org/en/docs/Canvas_tutorial:Basic_usage">Mozilla's documentation</a></p>
    <p>Note Chrome through version 10 incorrectly draws a filled shadow instead of a stroked shadow.</p>
    </body>
</html>